package com.atguigu.mq.work;

import com.atguigu.mq.util.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

public class Producer {
    public static void main(String[] args) throws Exception {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        String queue = "work_queue";
        channel.queueDeclare(queue,true,false,false,null);
        for (int i = 0; i < 10; i++) {
            String message = "hello rebbitmq work"+i;
            channel.basicPublish("",queue,null,message.getBytes());
        }
        channel.close();
        connection.close();
    }
}
